SQL Antipatterns: Avoiding the Pitfalls of Database Programming by Bill Karwin

SQL Antipatterns: Avoiding the Pitfalls of Database Programming by Bill Karwin

Author:Bill Karwin [Karwin, Bill]
Language: eng
Format: epub, pdf
Tags: Computers, Non-Fiction, Programming Languages, SQL, Technology
ISBN: 9781934356555
Google: Ghr4RAAACAAJ
Amazon: 1934356557
Publisher: Pragmatic Bookshelf
Published: 2010-01-15T00:00:00+00:00


You might think that the next query returns the complementary set of rows, that is, all rows not returned by the previous query:

Fear-Unknown/anti/search-not.sql

SELECT * FROM Bugs WHERE NOT (assigned_to = 123);

However, neither query result includes rows where assigned_to is null. Any comparison to null returns unknown, not true or false. Even the negation of null is still null.

It's common to make the following mistakes searching for null values or non-null values:

Fear-Unknown/anti/equals-null.sql

SELECT * FROM Bugs WHERE assigned_to = NULL;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.